﻿using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for MethodClassLoaiHang
/// </summary>
public class MethodClassLoaiHang
{
    SqlConnection con;
    SqlCommand command;
    Connection dt;
	public MethodClassLoaiHang()
	{
        dt = new Connection();
        con = dt.getConnect();
	}
    int execute()
    {
        SqlParameter res = new SqlParameter("@res", SqlDbType.Int);
        res.Direction = ParameterDirection.ReturnValue;
        command.Parameters.Add(res);
        command.ExecuteNonQuery();
        con.Close();
        int kq = Convert.ToInt32(res.Value);
        return kq;
    }
    public int ExecuteProcedure(string procedureName)
    {
        con.Open();
        command = new SqlCommand(procedureName, con);
        command.CommandType = CommandType.StoredProcedure;
        int kq = execute();
        return kq;
    }
    //public int insertInClass(string MaLoaiHang, string MoTaLoaiHang)
    //{
    //    con.Open();
    //    command = new SqlCommand("insertINCLASS", con);
    //    command.CommandType = CommandType.StoredProcedure;
    //    command.Parameters.Add(new SqlParameter("@inclasskey", MaNhanHieu));
    //    command.Parameters.Add(new SqlParameter("@description", MoTaNhanHieu));
    //    int kq = execute();
    //    return kq;
    //}
    //public int updateInClass(string MaLoaiHang, string MoTaLoaiHang)
    //{
    //    con.Open();
    //    command = new SqlCommand("updateINCLASS", con);
    //    command.CommandType = CommandType.StoredProcedure;
    //    command.Parameters.Add(new SqlParameter("@inclasskey", MaNhanHieu));
    //    command.Parameters.Add(new SqlParameter("@description", MoTaNhanHieu));
    //    int kq = execute();
    //    return kq;
    //}
}
